home *** CD-ROM | disk | FTP | other *** search
/ GameStar 2004 April / Gamestar_61_2004-04_dvdb.iso / DVDStar / Editace / hltp.exe / {app} / Source Code / Zoners Half-Life Tools / hlvis / vis.h < prev    next >
C/C++ Source or Header  |  2002-11-15  |  5KB  |  207 lines

  1. #ifndef HLVIS_H__
  2. #define HLVIS_H__
  3.  
  4. #if _MSC_VER >= 1000
  5. #pragma once
  6. #endif
  7.  
  8. #include "cmdlib.h"
  9. #include "messages.h"
  10. #include "win32fix.h"
  11. #include "log.h"
  12. #include "hlassert.h"
  13. #include "mathlib.h"
  14. #include "bspfile.h"
  15. #include "threads.h"
  16. #include "filelib.h"
  17.  
  18. #include "zones.h"
  19.  
  20.  
  21. #ifdef HLVIS_MAXDIST    // AJM: MVD
  22. #define DEFAULT_MAXDISTANCE_RANGE   0
  23. //#define DEFAULT_POST_COMPILE      0
  24. #define MAX_VISBLOCKERS 512
  25. #endif
  26.  
  27. #ifdef ZHLT_PROGRESSFILE // AJM
  28. #define DEFAULT_PROGRESSFILE NULL // progress file is only used if g_progressfile is non-null
  29. #endif
  30.  
  31. #define DEFAULT_FULLVIS     false
  32. #define DEFAULT_CHART       false
  33. #define DEFAULT_INFO        true
  34. #ifdef SYSTEM_WIN32
  35. #define DEFAULT_ESTIMATE    false
  36. #endif
  37. #ifdef SYSTEM_POSIX
  38. #define DEFAULT_ESTIMATE    true
  39. #endif
  40. #define DEFAULT_FASTVIS     false
  41. #define DEFAULT_NETVIS_PORT 21212
  42. #define DEFAULT_NETVIS_RATE 60
  43.  
  44. #define    MAX_PORTALS    32768
  45.  
  46. //#define USE_CHECK_STACK
  47. #define RVIS_LEVEL_1
  48. #define RVIS_LEVEL_2
  49.  
  50. #define PORTALFILE      "PRT1" // WTF?
  51.  
  52. #define    MAX_POINTS_ON_FIXED_WINDING    32
  53.  
  54. typedef struct
  55. {
  56.     bool            original;                              // don't free, it's part of the portal
  57.     int             numpoints;
  58.     vec3_t          points[MAX_POINTS_ON_FIXED_WINDING];
  59. } winding_t;
  60.  
  61. typedef struct
  62. {
  63.     vec3_t          normal;
  64.     float           dist;
  65. } plane_t;
  66.  
  67. typedef enum
  68.     stat_none, 
  69.     stat_working, 
  70.     stat_done 
  71. } vstatus_t;
  72.  
  73. typedef struct
  74. {
  75.     plane_t         plane;                                 // normal pointing into neighbor
  76.     int             leaf;                                  // neighbor
  77.     winding_t*      winding;
  78.     vstatus_t       status;
  79.     byte*           visbits;
  80.     byte*           mightsee;
  81.     unsigned        nummightsee;
  82.     int             numcansee;
  83. #ifdef ZHLT_NETVIS
  84.     int             fromclient;                            // which client did this come from
  85. #endif
  86.     UINT32          zone;                                  // Which zone is this portal a member of
  87. } portal_t;
  88.  
  89. typedef struct seperating_plane_s
  90. {
  91.     struct seperating_plane_s* next;
  92.     plane_t         plane;                                 // from portal is on positive side
  93. } sep_t;
  94.  
  95. typedef struct passage_s
  96. {
  97.     struct passage_s* next;
  98.     int             from, to;                              // leaf numbers
  99.     sep_t*          planes;
  100. } passage_t;
  101.  
  102. #define    MAX_PORTALS_ON_LEAF        256
  103. typedef struct leaf_s
  104. {
  105.     unsigned        numportals;
  106.     passage_t*      passages;
  107.     portal_t*       portals[MAX_PORTALS_ON_LEAF];
  108. } leaf_t;
  109.  
  110. typedef struct pstack_s
  111. {
  112.     byte            mightsee[MAX_MAP_LEAFS / 8];           // bit string
  113. #ifdef USE_CHECK_STACK
  114.     struct pstack_s* next;
  115. #endif
  116.     struct pstack_s* head;
  117.  
  118.     leaf_t*         leaf;
  119.     portal_t*       portal;                                // portal exiting
  120.     winding_t*      source;
  121.     winding_t*      pass;
  122.  
  123.     winding_t       windings[3];                           // source, pass, temp in any order
  124.     char            freewindings[3];
  125.  
  126.     const plane_t*  portalplane;
  127.  
  128. #ifdef RVIS_LEVEL_2
  129.     int             clipPlaneCount;
  130.     plane_t*        clipPlane;
  131. #endif
  132. } pstack_t;
  133.  
  134. typedef struct
  135. {
  136.     byte*           leafvis;                               // bit string
  137.     //      byte            fullportal[MAX_PORTALS/8];              // bit string
  138.     portal_t*       base;
  139.     pstack_t        pstack_head;
  140. } threaddata_t;
  141.  
  142. #ifdef HLVIS_MAXDIST
  143. // AJM: MVD
  144. // Special VISBLOCKER entity structure
  145. typedef struct
  146. {
  147.     char            name[64];
  148.     int                numplanes;
  149.     plane_t            planes[MAX_PORTALS_ON_LEAF];
  150.     int                numnames;
  151.     int                numleafs;
  152.     int                blockleafs[MAX_PORTALS];
  153.     char            blocknames[MAX_VISBLOCKERS][64];
  154. } visblocker_t;
  155. #endif
  156.  
  157. extern bool     g_fastvis;
  158. extern bool     g_fullvis;
  159.  
  160. extern int      g_numportals;
  161. extern unsigned g_portalleafs;
  162.  
  163. #ifdef HLVIS_MAXDIST // AJM: MVD
  164. extern unsigned int g_maxdistance;
  165. //extern bool        g_postcompile;
  166. #endif
  167.  
  168. extern portal_t*g_portals;
  169. extern leaf_t*  g_leafs;
  170.  
  171. #ifdef HLVIS_MAXDIST // AJM: MVD
  172. // Visblockers
  173. extern visblocker_t g_visblockers[MAX_VISBLOCKERS];
  174. extern int        g_numvisblockers;
  175. extern byte*    g_mightsee; 
  176. #endif
  177.  
  178. extern byte*    g_uncompressed;
  179. extern unsigned g_bitbytes;
  180. extern unsigned g_bitlongs;
  181.  
  182. extern volatile int g_vislocalpercent;
  183.  
  184. extern Zones*          g_Zones;
  185.  
  186. extern void     BasePortalVis(int threadnum);
  187.  
  188.  
  189. #ifdef HLVIS_MAXDIST // AJM: MVD
  190. extern visblocker_t *GetVisBlock(char *name);
  191. extern void        BlockVis(int unused);
  192. extern void        MaxDistVis(int threadnum);
  193. //extern void        PostMaxDistVis(int threadnum);
  194. #endif
  195.  
  196. extern void     PortalFlow(portal_t* p);
  197. extern void     CalcAmbientSounds();
  198.  
  199. #ifdef ZHLT_NETVIS
  200. #include "packet.h"
  201. #include "c2cpp.h"
  202. #include "NetvisSession.h"
  203. #endif
  204.  
  205. #endif //      byte            fullportal[MAX_PORTALS/8];              // bit string  HLVIS_H__
  206.